package com.helpustotravel.servlet;

import java.io.IOException;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.helpustotravel.core.ServletBase;
import com.helpustotravel.model.dao.ContactUsDAO;
import com.helpustotravel.model.jdo.ContactUs;

@SuppressWarnings("serial")
public class ContactUsServlet extends ServletBase {
	
	public static String NAME = "ContactUs";
	
	protected HttpServletResponse doTache(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		
		String email = req.getParameter("email");
		String message = req.getParameter("message");
		
		ContactUs contactUs = new ContactUs();
		contactUs.setDate(new Date());
		contactUs.setEmail(email);
		contactUs.setMessage(message);
		
		ContactUsDAO contacUsDao = new ContactUsDAO(pm);
		contacUsDao.contactUs(contactUs);
		
		return resp;
	}
}
